package com.qf.lanzhou.blog.api.controller;

import com.qf.lanzhou.blog.api.pojo.entity.Article;
import com.qf.lanzhou.blog.api.service.ArticleService;
import com.qf.lanzhou.blog.api.service.UserService;
import com.qf.lanzhou.blog.api.service.impl.ArticleServiceImp;
import com.qf.lanzhou.blog.api.service.impl.UserServiceImp;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author Yeach-chen
 * @ClassName AriticleShowList
 */
@WebServlet("/articleListTo.do")
public class AriticleShowList extends BaseServletPost{
    private ArticleService articleService =new ArticleServiceImp();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<Article> articleList=null;
        try {
            articleList = articleService.getArticleList();
            successResultWrite(articleList,resp);
        }catch (RuntimeException e){
            String message = e.getMessage();
            failedResultWrite(message,resp);
        }
    }
}
